#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e6 + 10;
struct S
{
    int x, y;
};
S s[N];
bool cmp(S a, S b)
{
    if (a.x != b.x) {
        return a.x < b.x;
    }
    else {
        return a.y < b.y;
    }
}
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        s[i] = { a,b };
    }
    sort(s, s + n, cmp);
    for (int i = 0; i < n - 1; i++) {
        if (s[i].y > s[i + 1].y) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}